﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tradex.Messaging {

    /// <summary>
    /// The Ping class represents a Ping message. Those are / can be sent by the bus to all ports regularly.
    /// Ping messages are never exposed to the Port, but handled internally (by sending back a Pong message).
    /// What they do, though, is tell the Bus that the port is "active" in handling messages (as otherwise the
    /// Pong would never arrive), as well as tell the Bus how long the Port took to answer. This allows central
    /// analysis of port health and performance.
    /// 
    /// Results from this are exposed both on the Port (where a Ping action callback can be registered), as well
    /// as on the Bus.
    /// </summary>
    public class Ping : Message {

        internal Ping(DateTime timeStamp) {
            PingTimestamp = timeStamp;
        }

        /// <summary>
        /// This is the internal timestamp of the Ping creation. The receiving Port can thus see how long the
        /// Ping was queued up before it was processed (and use this informnation to know whether it falls behind).
        /// </summary>
        public DateTime PingTimestamp { get; private set; }

    }
}
